Click here for interactive plots:

https://kforthman.shinyapps.io/COVID19_Interactive_Plots/

Click here to see how cities and counties overlap:

https://kforthman.shinyapps.io/500citiescounties

Compare COVID stats to Neighborhood Factors

data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

Compare COVID stats to 500 cities data and Neighborhood Factors

data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

—-Linear Mixed Effects Model —-

this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling

## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -1133.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.7870 -0.3388 -0.0848  0.1951  5.7214 
## 
## Random effects:
##  Groups   Name        Variance     Std.Dev. 
##  stateID  (Intercept) 0.0000007916 0.0008897
##  Residual             0.0000130205 0.0036084
## Number of obs: 169, groups:  stateID, 32
## 
## Fixed effects:
##                                  Estimate     Std. Error             df
## (Intercept)                 -0.0082746977   0.0092482150  63.0405055855
## Affluence                    0.0045143408   0.0010685088  90.7627502550
## Singletons.in.Tract          0.0016543371   0.0009304859 131.2345083517
## Seniors.in.Tract             0.0009547713   0.0012094606 141.6753743692
## African.Americans.in.Tract   0.0002478738   0.0010152953 143.6991673585
## Noncitizens.in.Tract         0.0008402504   0.0007498853 114.4243879231
## High.BP                      0.0002272403   0.0001861718  86.0965242442
## Binge.Drinking               0.0001389002   0.0001495917  34.2791707145
## Cancer                      -0.0008345377   0.0010714213  84.3052078031
## Asthma                       0.0004995414   0.0005219335  32.1209525041
## Heart.Disease                0.0006970758   0.0012481161  60.9114634260
## COPD                        -0.0000074504   0.0010550340  64.0181000174
## Smoking                     -0.0001364829   0.0002226376  67.8725308295
## Diabetes                    -0.0004725503   0.0005271498  65.5462685871
## No.Physical.Activity        -0.0000057796   0.0001988679  75.2591710707
## Obesity                      0.0002002965   0.0001707299  79.4812485173
## Poor.Sleeping.Habits        -0.0000013822   0.0001645511 116.8142930114
## Poor.Mental.Health          -0.0000003752   0.0003947858  26.0236345433
## Testing_Rate                 0.0000004996   0.0000003168  28.7507897306
## Hospitalization_Rate        -0.0001245472   0.0000862535  24.3916999506
##                            t value  Pr(>|t|)    
## (Intercept)                 -0.895    0.3743    
## Affluence                    4.225 0.0000568 ***
## Singletons.in.Tract          1.778    0.0777 .  
## Seniors.in.Tract             0.789    0.4312    
## African.Americans.in.Tract   0.244    0.8075    
## Noncitizens.in.Tract         1.121    0.2648    
## High.BP                      1.221    0.2256    
## Binge.Drinking               0.929    0.3596    
## Cancer                      -0.779    0.4382    
## Asthma                       0.957    0.3457    
## Heart.Disease                0.559    0.5785    
## COPD                        -0.007    0.9944    
## Smoking                     -0.613    0.5419    
## Diabetes                    -0.896    0.3733    
## No.Physical.Activity        -0.029    0.9769    
## Obesity                      1.173    0.2442    
## Poor.Sleeping.Habits        -0.008    0.9933    
## Poor.Mental.Health          -0.001    0.9992    
## Testing_Rate                 1.577    0.1258    
## Hospitalization_Rate        -1.444    0.1615    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence    0.156                                                        
## Sngltns.n.T -0.006  0.048                                                 
## Snrs.n.Trct  0.588  0.379  0.171                                          
## Afrcn.Am..T  0.192  0.162 -0.433  0.170                                   
## Nnctzns.n.T -0.009  0.094  0.048  0.061 -0.075                            
## High.BP      0.018  0.247  0.094  0.135 -0.108  0.397                     
## Bing.Drnkng -0.246 -0.178 -0.302 -0.167  0.114  0.053  0.144              
## Cancer      -0.597 -0.215  0.182 -0.343 -0.081 -0.156 -0.398 -0.131       
## Asthma      -0.358 -0.215 -0.206 -0.167  0.075  0.086  0.168 -0.017  0.040
## Heart.Dises -0.147  0.079 -0.285 -0.149  0.237 -0.098 -0.031  0.063 -0.460
## COPD         0.553  0.039  0.133  0.271  0.008  0.289  0.213  0.122 -0.268
## Smoking     -0.189  0.109 -0.180 -0.131 -0.084 -0.006 -0.107 -0.300  0.086
## Diabetes     0.058 -0.310 -0.160 -0.234 -0.273 -0.325 -0.528  0.039  0.221
## N.Physcl.Ac -0.180 -0.074  0.101 -0.032 -0.036 -0.233 -0.119  0.084  0.494
## Obesity      0.026  0.437  0.393  0.306  0.163  0.213 -0.070 -0.221  0.104
## Pr.Slpng.Hb -0.496 -0.414  0.182 -0.389 -0.404  0.006 -0.184  0.065  0.173
## Pr.Mntl.Hlt -0.317  0.263 -0.049 -0.054  0.109 -0.199 -0.092  0.047  0.310
## Testing_Rat  0.192 -0.082 -0.085 -0.006  0.065 -0.092 -0.021  0.020 -0.193
## Hsptlztn_Rt -0.132 -0.218 -0.156 -0.266 -0.074 -0.127 -0.140 -0.165  0.056
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence                                                                 
## Sngltns.n.T                                                               
## Snrs.n.Trct                                                               
## Afrcn.Am..T                                                               
## Nnctzns.n.T                                                               
## High.BP                                                                   
## Bing.Drnkng                                                               
## Cancer                                                                    
## Asthma                                                                    
## Heart.Dises  0.274                                                        
## COPD        -0.366 -0.565                                                 
## Smoking      0.076  0.220 -0.526                                          
## Diabetes    -0.121 -0.237 -0.159  0.289                                   
## N.Physcl.Ac  0.013 -0.394 -0.001 -0.347 -0.087                            
## Obesity     -0.286 -0.107  0.188 -0.217 -0.399 -0.061                     
## Pr.Slpng.Hb  0.082  0.243 -0.215  0.038 -0.018 -0.098 -0.172              
## Pr.Mntl.Hlt -0.223  0.093 -0.457  0.076  0.032  0.078  0.093 -0.191       
## Testing_Rat -0.354 -0.022  0.184  0.179  0.151 -0.329  0.078 -0.142 -0.128
## Hsptlztn_Rt  0.050  0.074 -0.106  0.149  0.124 -0.035 -0.118  0.009 -0.058
##             Tstn_R
## Affluence         
## Sngltns.n.T       
## Snrs.n.Trct       
## Afrcn.Am..T       
## Nnctzns.n.T       
## High.BP           
## Bing.Drnkng       
## Cancer            
## Asthma            
## Heart.Dises       
## COPD              
## Smoking           
## Diabetes          
## N.Physcl.Ac       
## Obesity           
## Pr.Slpng.Hb       
## Pr.Mntl.Hlt       
## Testing_Rat       
## Hsptlztn_Rt  0.283
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling

Testing Rate

testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]

col.state <- rep("pink", nrow(testing.data.state))

avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)

col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"

par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")

day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)

par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days], main = "Total COVID-19 cases by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)

barplot(US.total$cases.total[day.first.case:n.days], main = "Total COVID-19 cases by Date in US, log scale", las = 2, cex.axis = 1, cex.names = 0.5, log = "y")

barplot(US.total$deaths.total[day.first.case:n.days], main = "Total COVID-19 deaths by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)

barplot(US.total$deaths.total[day.first.case:n.days], main = "Total COVID-19 deaths by Date in US, log scale", las = 2, cex.axis = 1, cex.names = 0.5, log = "y")

barplot(US.total$rise.cases.total[day.first.case:n.days], main = "Rise in Cases of COVID-19 by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)

barplot(US.total$rise.deaths.total[day.first.case:n.days], main = "Rise in Deaths of COVID-19 by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)